/*--------------------------------------------------------------------------.DA*
  Name:           KFXAP.h
  Description:    Aplication functions
  Version: 07.12.01 /AL                             Copyrights (c) 1998, STW
  --------------------------------------------------------------------------.DE*/
#ifndef H_KFXAP
#define H_KFXAP

#ifdef __cplusplus
extern "C" {
#endif

   //constants for EEPROM/RAM variable definitions
   #define KFX_TYPE_BYTE   0x01
   #define KFX_TYPE_CHAR   0x02
   #define KFX_TYPE_INT    0x03
   #define KFX_TYPE_WORD   0x04
   #define KFX_TYPE_LONG   0x05
   #define KFX_TYPE_DWORD  0x06
   #define KFX_TYPE_STRING 0x07
   #define KFX_TYPE_CRC    0x08 //only valid for EEPROM variables !
   #define KFX_TYPE_AOBYTE 0x09
   #define KFX_TYPE_FLOAT  0x0A
   #define KFX_TYPE_EOL    0xFF

   #define KFX_VARIABLE_TYPE_RAM    0x01
   #define KFX_VARIABLE_TYPE_EEPROM 0x02
   //#define KFX_VARIABLE_TYPE_ROM    0x03

   #define KFX_LIST_INDEX_MAX 64  //Max. number of variable lists
   #define KFX_VAR_INDEX_MAX 1024 //Max. number of variable values in one list

   //RAM variable structure
   typedef struct
   {
      KFX_TRG_ADDRESS_TYPE u32_Address; //Address in EEPROM/ROM
      KFX_TRG_SIZE_TYPE    u32_Size;    //Size in bytes
      uint8  u8_DataType; //
      void   *pv_Value;   //0 -> special handling (user defined)
   } tKEFEXVariableEntry;

   //RAM data list configuration structure
   typedef struct
   {
      const tKEFEXVariableEntry * pt_FirstEntry;
      uint8 u8_VariableType;
      uint16 u16_NumEntries;
   } tKEFEXListDefinition;

   extern sint16 KFX_init_RS232_ext(const T_KFXRS232InitParams * const opt_SerParameters, const uint8 ou8_OwnAddress, const uint8 ou8_ClientAddress, const uint8 ou8_BaseIDKEFEX);
   extern sint16 KFX_init_CAN_ext  (const T_KFXCANInitParams * const opt_CANParameters, const uint8 ou8_OwnAddress, const uint8 ou8_ClientAddress, const uint8 ou8_BaseIDKEFEX);
   extern void KFX_task(void);
   extern void KFX_activate_startup_message(void);
   extern void KFX_set_application_version(const uint16 ou16_Version);
   extern void KFX_set_application_name(const uint8 * opu8_ApplicationName);

#ifdef __cplusplus
}
#endif

#endif

